//
//  JJHomepageViewController.m
//  iosDemo
//
//  Created by gongjian on 2018/12/14.
//  Copyright © 2018 JJ. All rights reserved.
//

#import "JJHomepageViewController.h"

#import "JJHomepagePresenter.h"

@interface JJHomepageViewController ()

@end

@implementation JJHomepageViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
}

- (void)viewDidAppear:(BOOL)animated {
	[super viewDidAppear:animated];
}

- (IBAction)getWeather:(id)sender {
	[self.homepagePresenter requestGetWeather:^(JJHomepageModel * _Nonnull object, id  _Nonnull otherinfo) {
		self.label.text = self.homepagePresenter.errMsg;
	} networkFailResponse:^(NSError * _Nonnull error, id  _Nonnull otherinfo) {
        self.label.text = error.localizedDescription;
	}];
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

- (JJHomepagePresenter *)homepagePresenter {
	if (!_homepagePresenter) {
		_homepagePresenter = [[JJHomepagePresenter alloc] init];
	}
	
	return _homepagePresenter;
}

@end
